package com.note.simpleshop.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import springfox.documentation.annotations.ApiIgnore;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "tb_cart", schema = "simpleshop", catalog = "")
public class TbCart {
    public static final Integer IS_DELEETE0=0;
    public static final Integer IS_DELETE1=1;
    @ApiModelProperty(hidden =true)
    private String id;
    private String goodsId;
    private String goodsSpecId;
    @ApiModelProperty(hidden =true)
    private String userId;
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date addTime;
    private Integer num;
    private BigDecimal price;
    @ApiModelProperty(hidden =true)
    private Integer isDelete;
    public TbCart() {
    }
    @Id
    @Column(name = "id")
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    @Basic
    @Column(name = "goods_id")
    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    @Basic
    @Column(name = "goods_spec_id")
    public String getGoodsSpecId() {
        return goodsSpecId;
    }

    public void setGoodsSpecId(String goodsSpecId) {
        this.goodsSpecId = goodsSpecId;
    }

    @Basic
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "add_time")
    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    @Basic
    @Column(name = "num")
    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    @Basic
    @Column(name = "price")
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Basic
    @Column(name = "is_delete")
    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TbCart tbCart = (TbCart) o;
        return Objects.equals(id, tbCart.id) &&
                Objects.equals(goodsId, tbCart.goodsId) &&
                Objects.equals(goodsSpecId, tbCart.goodsSpecId) &&
                Objects.equals(userId, tbCart.userId) &&
                Objects.equals(addTime, tbCart.addTime) &&
                Objects.equals(num, tbCart.num) &&
                Objects.equals(price, tbCart.price) &&
                Objects.equals(isDelete, tbCart.isDelete);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, goodsId, goodsSpecId, userId, addTime, num, price, isDelete);
    }
}
